package com.ybkj.chat.module.dynamic.activity;


import android.content.Intent;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.bean.Expand1Item;
import com.ybkj.chat.bean.ExpandItem;
import com.ybkj.chat.module.dynamic.adapter.ChooseFriendAdapter;
import com.ybkj.chat.ui.view.recyclerview.XRecyclerView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 选择圈友(选择分组的人) 9.11
 */
public class ChooseFriendActivity extends BaseMvpActivity {

    @BindView(R.id.irc)
    XRecyclerView irc;

    private ChooseFriendAdapter mChooseFriendAdapter;

    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {
        setTitleText("选择圈友");
        setRightText("完成");
        setRightTextColor(R.color.color_dfd);
        setRightTextVisible(true);
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_choose_friend;
    }

    @Override
    protected void initView() {
        Intent intent = getIntent();
        intent.getStringExtra("GroupName");//分组名
        initrecycle();

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onRightTextClick() {
        super.onRightTextClick();
    }

    private void initrecycle() {
        mChooseFriendAdapter = new ChooseFriendAdapter(getExpandListData(4));
        mChooseFriendAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
        irc.setAdapter(mChooseFriendAdapter);
        mChooseFriendAdapter.expandAll(0, true);
    }

    private List<MultiItemEntity> getExpandListData(int count) {
        int lvCount = count;
        int lv1Count = 6;

        List<MultiItemEntity> data = new ArrayList<>();
        for (int i = 0; i < lvCount; i++) {
            ExpandItem item0 = new ExpandItem("最近联系人" + i);
            for (int k = 0; k < lv1Count; k++) {
                item0.addSubItem(new Expand1Item(" Blanche" + k));
            }
            data.add(item0);
        }
        return data;
    }
}
